﻿using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using Autofac;
using MaximServices.Services.MottoCrawl;

namespace MaximServices
{
    public class CoreModule : Autofac.Module
    {
        protected override void Load(ContainerBuilder builder)
        {
            base.Load(builder);

            builder.RegisterAssemblyTypes(AppDomain.CurrentDomain.GetAssemblies())
                .Where(t => t.Name.EndsWith("Repository") || t.Name.EndsWith("Services"))
                .AsSelf()
                .InstancePerLifetimeScope();

            builder.RegisterType<BaiduBaikeCrawl>().Keyed<IBaikeCrawl>("baidu").InstancePerLifetimeScope();
        }
    }
}